
**************************************************************
* Create a dataset with 2009 EU election participation
**************************************************************

clear all
odbc load, table("EU_Val_2009") connectionstring("DRIVER={SQL Server};SERVER={mq02\b};DATABASE={P0846};Trusted_Connection={Yes}")

destring e, replace
drop if e == 3
tab e, miss
gen voted2009 = e != 1
tab voted2009
drop e
drop if P0846_LopNr_PersonNr == .
duplicates tag P0846_LopNr_PersonNr, gen(duplicate)
drop if duplicate != 0
drop duplicate
compress

rename P0846_LopNr_PersonNr PersonId
save Data/data_voting_EU_2009, replace


